import sys
import time
from threadPool import FixThreadPoolExecutor, ThreadPoolParams


def add(a, b):
    """
    实际工作中处理函数
    :param a:
    :param b:
    :return:
    """
    time.sleep(1)
    print(f"{a} + {b} = ", a + b)


def task_func():
    """
    构建任务函数
    :return:
    """
    for i in range(100):
        yield ThreadPoolParams(add, *(i, i + 1))


if __name__ == '__main__':
    print(sys.path)
    FixThreadPoolExecutor(pool_size=10, task_total=100).run(task_iterable_func=task_func)
